//
//  YWTestViewController.m
//  maintain
//
//  Created by 郑想 on 15/10/19.
//  Copyright © 2015年 ewin. All rights reserved.
//

#import "MBProgressHUD.h"
#import "YWAlertView.h"
#import "YWDBTool.h"
#import "YWMacro.h"
#import "YWTestViewController.h"
#import <pop/POP.h>

@implementation YWTestViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = YWRandomColor;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)touchesBegan:(NSSet<UITouch*>*)touches withEvent:(UIEvent*)event
{
    // [self showtwoBtn];//显示提示框 需要点击按钮的

    // [self setTableData];//数据库使用

    // [self showHUD];//提示信息
}
#pragma mark--alertview
- (void)showtwoBtn
{
    YWAlertView* alert = [[YWAlertView alloc] initWithTitle:@"提示" contentText:@"显示内容" leftButtonTitle:@"取消" rightButtonTitle:@"确定"];
    [alert show];
    alert.leftBlock = ^() {
        YWLog(@"left button clicked");
    };
    alert.rightBlock = ^() {
        YWLog(@"right button clicked");
    };
    alert.dismissBlock = ^() {
        YWLog(@"Do something interesting after dismiss block");
    };
}

- (void)showOneBtn
{
    YWAlertView* alert = [[YWAlertView alloc] initWithTitle:@"提示" contentText:@"显示内容" leftButtonTitle:nil rightButtonTitle:@"确定"];
    [alert show];
    alert.rightBlock = ^() {
        YWLog(@"right button clicked");
    };
    alert.dismissBlock = ^() {
        YWLog(@"Do something interesting after dismiss block");
    };
}

#pragma mark--DBTOOL
- (void)setTableData
{
    [[YWDBTool shareDBTool] connectDB:@"1"];
    YWLog(@"dbPath: %@", [[YWDBTool shareDBTool] dbPath]);
}

#pragma mark--MBProgressHUD
- (void)showHUD
{
    MBProgressHUD* hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    hud.mode = MBProgressHUDModeText;
    hud.labelText = @"点击页面了。。。。";
    hud.margin = 10.f;
    hud.removeFromSuperViewOnHide = YES;
    [hud hide:YES afterDelay:3];
}

@end
